package com.qingcheng.controller;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author 岳剑飞
 * @Company http://www.ithiema.com
 */
@Controller
@RequestMapping("/redirect")
public class RedirectController {

    /**
     * 登录地址返回,,当浏览器向web服务器发送请求时,一般会带上Referer,,告诉服务器我是从那个页面链接过来,
     * @param referer
     * @return
     */
    @RequestMapping("/back")
    public String redirect (@RequestHeader(value = "Referer",required = false)String referer){
        if (!StringUtils.isEmpty(referer)){
            return "redirect:"+referer;
        }
        return "redirect:/seckill-index.html";
    }















}
